export const schema = {
    type: 'page',
    title: "自定义认证信息",
    body: [
        {
            type: 'wrapper',
            className: 'no-padder no-bg clear',
            body: [
                {
                    type: "nav",
                    stacked: false,
                    links: [
                        {
                            label: "编辑",
                            to: "/org/edit/${id}"
                        },
                        {
                            label: "设置",
                            to: "/org/setting/${id}"
                        },
                        {
                            label: "自定义认证信息",
                            to: "/org/infosetting/${id}"
                        },
                        {
                            label: "微信模板信息设置",
                            to: "/org/wechatmessage/${id}"
                        },
                    ]
                }]
        },
        {
            title: null,
            panelClassName: 'no-border no-shadow',
            type: 'form',
            api: "post:/api/org/${id}/opensettings",
            initApi: "get:/api/org/${id}/opensettings",
            actions: [
                {
                    label: '保存',
                    type: 'submit',
                    level: 'info',
                }
            ],
            fieldSet: [
                {
                    title: '启用设置',
                    subTitle: '提示：勾选后，用户将必须填写相关信息',
                    controls: [
                        {
                            type: 'checkbox',
                            name: 'real_name_register',
                            option: "是否要求完善个人信息",
                            trueValue: 1,
                            falseValue: 0
                        },
                    ],
                },
                {
                    title: '默认设置',
                    subTitle: '提示：勾选后，用户将必须填写相关信息',
                    controls: [
                        {
                            type: 'checkbox',
                            name: 'open_real_name',
                            option: "姓名",
                            trueValue: 1,
                            falseValue: 0
                        },
                        {
                            type: 'checkbox',
                            name: 'open_avatars',
                            option: "头像",
                            trueValue: 1,
                            falseValue: 0
                        },
                        {
                            type: 'checkbox',
                            name: 'open_id_number',
                            option: "身份证",
                            trueValue: 1,
                            falseValue: 0
                        },
                        {
                            type: 'checkbox',
                            name: 'open_nation',
                            option: "民族",
                            trueValue: 1,
                            falseValue: 0
                        },
                        {
                            type: 'checkbox',
                            name: 'open_addr',
                            option: "地址",
                            trueValue: 1,
                            falseValue: 0
                        },
                    ],
                }
            ]

        },
        {
            type: "wrapper",
            title: "自定义信息列表",
            // panelClassName: 'no-border no-shadow',
            // subTitle: "test",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                type: "crud",
                api: "get:/api/org/${id}/infosettings",
                columnsTogglable: false,
                panelClassName: 'no-border no-shadow bg-white',
                // draggableOn: true,
                draggable: true,
                saveOrderApi: "put:/api/org/${id}/sortinfosettings",
                primaryField: "key",
                toolbar: {
                    type: "button",
                    icon: "fa fa-plus pull-left",
                    className: 'pull-right',
                    level: "success",
                    label: "添加认证信息",
                    size: "sm",
                    actionType: "dialog",
                    dialog: {
                        title: "添加认证信息",
                        body: {
                            type: "form",
                            api: "post:/api/org/${id}/infosettings",
                            controls: [
                                {
                                    type: "text",
                                    name: "key",
                                    label: "标识",
                                    desc: "自定义信息唯一标识",
                                    // validations: "isAlphanumeric",
                                    required: true
                                },

                                {
                                    type: "text",
                                    name: "label",
                                    label: "标题名称",
                                    required: true
                                },

                                {
                                    type: 'select',
                                    name: 'type',
                                    label: "类别",
                                    // placeholder: '类别',
                                    options: [
                                        {
                                            value: '1',
                                            label: '单项选择'
                                        },

                                        {
                                            value: '2',
                                            label: '多项选择'
                                        },

                                        {
                                            value: '3',
                                            label: '单行输入'
                                        },

                                        {
                                            value: '4',
                                            label: '多行输入'
                                        },

                                        {
                                            value: '5',
                                            label: '上传图片'
                                        },

                                        {
                                            value: '6',
                                            label: '日期控件'
                                        },

                                        {
                                            value: '7',
                                            label: '时间控件'
                                        }
                                    ]
                                },

                                {
                                    type: "text",
                                    name: "options",
                                    label: "选项内容",
                                    visibleOn: "data.type == 1 || data.type == 2",
                                    desc: "请用英文标点\",\"分格",
                                    required: true
                                },

                                {
                                    type: "switch",
                                    name: "is_required",
                                    trueValue: 1,
                                    falseValue: 0,
                                    value: 1,
                                    label: "是否必填",
                                }
                            ]
                        }
                    }
                },
                // showHeader: false,
                columns: [
                    {
                        name: "key",
                        label: "自定义标识"
                    },

                    {
                        name: "label",
                        label: "标题名称"
                    },

                    {
                        name: "type",
                        label: "类型",
                        type: 'map',
                        map: {
                            '1': "<span class='label label-info'>单项选择</span>",
                            '2': "<span class='label label-info'>多项选择</span>",
                            '3': "<span class='label label-info'>单行输入</span>",
                            '4': "<span class='label label-info'>多行输入</span>",
                            '5': "<span class='label label-info'>上传图片</span>",
                            '6': "<span class='label label-info'>日期控件</span>",
                            '7': "<span class='label label-info'>时间控件</span>",
                        }
                    },

                    {
                        name: "options",
                        label: "选项"
                    },

                    {
                        name: "is_required",
                        label: "是否必填",
                        type: 'map',
                        map: {
                            '*': "<span class='label label-default'>否</span>",
                            '1': "<span class='label label-success'>是</span>"
                        }
                    },

                    {
                        label: "操作",
                        type: "operation",
                        width: 180,
                        buttons: [{
                            type: "button",
                            size: "xs",
                            level: "info",
                            label: "编辑",
                            actionType: "dialog",
                            dialog: {
                                title: "编辑认证信息",
                                body: {
                                    type: "form",
                                    api: "put:/api/org/${id}/infosettings",
                                    controls: [
                                        {
                                            type: "text",
                                            name: "key",
                                            label: "标识",
                                            desc: "自定义信息唯一标识",
                                            disabled: true
                                            // validations: "isAlphanumeric",
                                            // required: true
                                        },

                                        {
                                            type: "text",
                                            name: "label",
                                            label: "标题名称",
                                            required: true
                                        },

                                        {
                                            type: 'select',
                                            name: 'type',
                                            label: "类别",
                                            // placeholder: '类别',
                                            options: [
                                                {
                                                    value: '1',
                                                    label: '单项选择'
                                                },

                                                {
                                                    value: '2',
                                                    label: '多项选择'
                                                },

                                                {
                                                    value: '3',
                                                    label: '单行输入'
                                                },

                                                {
                                                    value: '4',
                                                    label: '多行输入'
                                                },

                                                {
                                                    value: '5',
                                                    label: '上传图片'
                                                },

                                                {
                                                    value: '6',
                                                    label: '日期控件'
                                                },

                                                {
                                                    value: '7',
                                                    label: '时间控件'
                                                }
                                            ]
                                        },

                                        {
                                            type: "text",
                                            name: "options",
                                            label: "选项内容",
                                            visibleOn: "data.type == 1 || data.type == 2",
                                            desc: "请用英文标点\",\"分格",
                                            required: true
                                        },

                                        {
                                            type: "switch",
                                            name: "is_required",
                                            trueValue: 1,
                                            falseValue: 0,
                                            label: "是否必填",
                                        }
                                    ]
                                }
                            }
                        }, {
                            type: "button",
                            size: "xs",
                            label: "删除",
                            level: "danger",
                            confirmText: "确定要删除？",
                            actionType: "ajax",
                            api: "delete:/api/org/${id}/infosettings?key=${key}"
                        }]
                    }]
            }
        }]
};
